#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <list>
#include "../../../NetEngine_Linux/NetEngine_Release/NetEngine_Include/XyRyNet_CommHdr.h"
#include "../../../NetEngine_Linux/NetEngine_Release/NetEngine_Include/XyRyNet_Types.h"
#include "../../../NetEngine_Linux/NetEngine_Release/NetEngine_Include/XyRyNet_ProtocolHdr.h"
#include "../../../NetEngine_Linux/NetEngine_SourceCode/NetEngine/NetEngine_Core/NetCore_Define.h"
#include "../../../NetEngine_Linux/NetEngine_SourceCode/NetEngine/NetEngine_Core/NetCore_Error.h"

//g++ -std=gnu++11 -Wall -g Test_Server.cpp -o Test_Server -L ../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_BaseLib -L ../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_Core -lNetEngine_BaseLib -lNetEngine_Core -Wl,-rpath=../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_BaseLib:../../../NetEngine_Linux/NetEngine_Release/NetEngine_Release/NetEngine_Core,--disable-new-dtags

void NetCore_TCPPoll_CBLogin(LPCTSTR lpszClientAddr,int nType,LPVOID lParam)
{
    printf("NetCore_TCPPoll_CBLogin:%s = %d\n",lpszClientAddr,nType);
}
void NetCore_TCPPoll_CBRecv(LPCTSTR lpszClientAddr,LPCTSTR lpszMsgBuffer,int nMsgLen,LPVOID lParam)
{
    printf("NetCore_TCPPoll_CBRecv:%s = %d,%s\n",lpszClientAddr,nMsgLen,lpszMsgBuffer);
    if (!NetCore_TCPPoll_Send(lpszClientAddr,lpszMsgBuffer,&nMsgLen))
    {
        printf("NetCore_TCPPoll_Send failed:%lX\n",NetCore_GetLastError());
    }
}
void NetCore_TCPPoll_CBLeave(LPCTSTR lpszClientAddr,LPVOID lParam)
{
    printf("NetCore_TCPPoll_CBLeave:%s\n",lpszClientAddr);
}

int main()
{
    if (!NetCore_TCPPoll_Start(6000))
    {
        printf("Error");
        return -1;
    }
    NetCore_TCPPoll_SetCallBack(NetCore_TCPPoll_CBLogin,NetCore_TCPPoll_CBRecv,NetCore_TCPPoll_CBLeave);
    printf("okl\n");

    do{
         sleep(0xFFFFFFFF);
    }while(1);
    return 0;
}
